AIDL HAL 教程使用 Ubuntu2204 + Android14 环境进行学习。
# 使用 VMware 虚拟机安装 Ubuntu 2204
VMware 虚拟机安装 Ubuntu 2204,这部分内容可以参考AOSP 极速上手 (opens new window)
将镜像文件更换为 Ubuntu2204 的即可
# AOSP Android14 下载与编译
# 下载
repo init https://mirrors.tuna.tsinghua.edu.cn/git/AOSP/platform/manifest -b android-14.0.0_r15
repo sync
# 编译
source build/envsetup.sh
lunch aosp_cf_x86_64_phone-eng
m
1
2
3
4
5
6
7
8
2
3
4
5
6
7
8
Cuttlefish 模拟器安装与启动:
安装 CuttleFish 所需的依赖:
sudo apt install -y git devscripts config-package-dev debhelper-compat golang curl
git clone https://github.com/google/android-cuttlefish
cd android-cuttlefish
for dir in base frontend; do
cd $dir
debuild -i -us -uc -b -d
cd ..
done
sudo dpkg -i ./cuttlefish-base_*_*64.deb || sudo apt-get install -f
sudo dpkg -i ./cuttlefish-user_*_*64.deb || sudo apt-get install -f
sudo usermod -aG kvm,cvdnetwork,render $USER
sudo reboot
1
2
3
4
5
6
7
8
9
10
11
12
2
3
4
5
6
7
8
9
10
11
12
启动模拟器:
launch_cvd --start_webrtc=true
1
浏览器中输入 https://localhost:8443
即可使用虚拟机了
# Kernel 下载与编译
# 下载编译
repo init -u https://android.googlesource.com/kernel/manifest -b common-android14-6.1
repo sync
# 编译
tools/bazel run //common-modules/virtual-device:virtual_device_x86_64_dist
1
2
3
4
5
6
2
3
4
5
6
Cuttlefish 加载编译 x86 的内核和 ramdisk:
cvd start -kernel_path=/home/zzh0838/Project/aosp/kernel/out/virtual_device_x86_64/dist/bzImage -initramfs_path=/home/zzh0838/Project/aosp/kernel/out/virtual_device_x86_64/dist/initramfs.img
1